using System.Linq;
using System.Text;

namespace Gko.Utils
{
	// IElementComparer is a helper interface for OrderedEnumerable that can compare items in a source array given their indexes.
	// It supports chaining multiple comparers together to allow secondary, tertiary, etc. sorting.
	internal interface IElementComparer<TSource>
	{
		// Compares the two items at the specified indexes.
		int Compare(int left, int right);

		// Creates all the keys needed to compare items.
		void CreateSortKeys(TSource[] source);

		// Creates a new IElementComparer by appending the specified ordering to this ordering, chaining them together.
		IElementComparer<TSource> Append(IElementComparer<TSource> elementComparer);
	}
}
